<template>
    <div>
        <phone-input :config="config.data[0]" />
        <code-input v-if="config.isVerify&&isHide" :config="config.data[1]" />
    </div>
</template>

<script>
import PhoneInput from '../components/PhoneInput';
import CodeInput from '../components/CodeInput';
export default {
    props: ['config'],
    data() {
        return {
            isHide: false
        };
    },
    components: {
        'phone-input': PhoneInput,
        'code-input': CodeInput
    },
    watch: {
        config: {
            handler: function(val, oldVal) {
                if (/^1[345678]\d{9}$/.test(val.data[0].value)) {
                    this.isHide = true;
                } else {
                    this.isHide = false;
                }
            },
            deep: true
        }
    }
};
</script>

<style>

</style>
